//
//  HETWRaidoCell.m
//  HealthFamily
//
//  Created by 吴欧 on 2020/11/18.
//  Copyright © 2020 honglutec. All rights reserved.
//

#import "HETWRaidoCell.h"
#import "DLRadioButton.h"

@interface HETWRaidoCell ()

@property(nonatomic, strong) DLRadioButton *radioBtn;

@end

@implementation HETWRaidoCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        [self initUI];
    }
    return self;
}

- (void)initUI {
    
    _radioBtn = [DLRadioButton new];
    _radioBtn.tag = 1;
    _radioBtn.marginWidth = 10;
    _radioBtn.multipleSelectionEnabled = YES;
    _radioBtn.icon = [UIImage imageNamed:@"check_box_unsel"];
    _radioBtn.iconSelected = [UIImage imageNamed:@"check_box_sel"];
    [_radioBtn setTitle:@"-" forState:UIControlStateNormal];
    [_radioBtn setTitleColor:CNavLightBlackColor forState:UIControlStateNormal];
    _radioBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    _radioBtn.titleLabel.font = DYFont(15);
    [_radioBtn addTarget:self action:@selector(radioSelectedButton:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:_radioBtn];
    
    [_radioBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).mas_offset(15);
        make.left.equalTo(self.contentView).offset(15);
        make.right.equalTo(self.contentView).offset(-15);
        make.bottom.equalTo(self.contentView).mas_offset(-15);
    }];
    
}

- (void)refreshContent:(GDFiterCellModel *)fiterModel formModel:(GDFormModel *)formModel indexPath:(NSIndexPath *)indexPath {

    [_radioBtn setTitle: fiterModel.leftTitle forState:UIControlStateNormal];
}

- (void)radioSelectedButton:(DLRadioButton *)radioButton {
    NSInteger index = radioButton.tag;
    BOOL issel = radioButton.isSelected;
    self.formModel.tw_hasSee = issel;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
